<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        var name = 'window1';
        var obj1 = {
            name:'1',
            fn1:function (){
                console.log(this.name);
            },
            fn2:()=>console.log(this.name),
            fn3: function (){
                return function (){
                    console.log(this.name);
                }
            },
            fn4: function(){
                return () => console.log(this.name);
            }
        };
        var obj2 = {
            name: '2',
            // function (){
            //         console.log(this.name);
            //     }
        };
        obj1.fn1();//1
        obj1.fn1.call(obj2);//2

        obj1.fn2();//window1
        obj1.fn2.call(obj2);//window1

        obj1.fn3()();//window1
        obj1.fn3().call(obj2);//2
        obj1.fn3.call(obj2)();//window1

        obj1.fn4()();//window1
        obj1.fn4().call(obj2);//1
        obj1.fn4.call(obj2)();//1 2
// **3.QQ**号：第一位不可以是0，位数在5-12位数字构成
        console.log(/[1-9]\d{4,11}/.test(11111));
// 5.**密码**：字母、数字、下划线构成，6-20位
        console.log(/[\w\d]{6,20}/.test('aAa1_1'));
// 6.**用户名**：字母、数字、下划线构成，6-16位，不能以数字开头
        console.log(/[^\d][\w\d]{5,15}/.test('_aaaa1'));
// 8.**身份证号码**：15或18位，如果是15位则全部为数字，
// 如果为18位，前17位为数字，第18位为数字或字母x，字母不区分大小写
    console.log(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test('36078120031110583X'));
    
        

    </script>
</body>
</html>